Left Termination of the query pattern f_in_3(g, a, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

f(0, Y, 0).
f(s(X), Y, Z) :- ','(f(X, Y, U), f(U, Y, Z)).

Queries:

f(g,a,a).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
f_in: (b,f,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

F_IN_GAA(s(X), Y, Z) → U1_GAA(X, Y, Z, f_in_gaa(X, Y, U))
F_IN_GAA(s(X), Y, Z) → F_IN_GAA(X, Y, U)
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → U2_GAA(X, Y, Z, U, f_in_gaa(U, Y, Z))
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → F_IN_GAA(U, Y, Z)

The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)
U2_GAA(x1, x2, x3, x4, x5)  =  U2_GAA(x5)
F_IN_GAA(x1, x2, x3)  =  F_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

F_IN_GAA(s(X), Y, Z) → U1_GAA(X, Y, Z, f_in_gaa(X, Y, U))
F_IN_GAA(s(X), Y, Z) → F_IN_GAA(X, Y, U)
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → U2_GAA(X, Y, Z, U, f_in_gaa(U, Y, Z))
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → F_IN_GAA(U, Y, Z)

The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)
U2_GAA(x1, x2, x3, x4, x5)  =  U2_GAA(x5)
F_IN_GAA(x1, x2, x3)  =  F_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 1 SCC with 1 less node.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
PiDP
              ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

F_IN_GAA(s(X), Y, Z) → F_IN_GAA(X, Y, U)
F_IN_GAA(s(X), Y, Z) → U1_GAA(X, Y, Z, f_in_gaa(X, Y, U))
U1_GAA(X, Y, Z, f_out_gaa(X, Y, U)) → F_IN_GAA(U, Y, Z)

The TRS R consists of the following rules:

f_in_gaa(0, Y, 0) → f_out_gaa(0, Y, 0)
f_in_gaa(s(X), Y, Z) → U1_gaa(X, Y, Z, f_in_gaa(X, Y, U))
U1_gaa(X, Y, Z, f_out_gaa(X, Y, U)) → U2_gaa(X, Y, Z, U, f_in_gaa(U, Y, Z))
U2_gaa(X, Y, Z, U, f_out_gaa(U, Y, Z)) → f_out_gaa(s(X), Y, Z)

The argument filtering Pi contains the following mapping:
f_in_gaa(x1, x2, x3)  =  f_in_gaa(x1)
0  =  0
f_out_gaa(x1, x2, x3)  =  f_out_gaa(x3)
s(x1)  =  s(x1)
U1_gaa(x1, x2, x3, x4)  =  U1_gaa(x4)
U2_gaa(x1, x2, x3, x4, x5)  =  U2_gaa(x5)
F_IN_GAA(x1, x2, x3)  =  F_IN_GAA(x1)
U1_GAA(x1, x2, x3, x4)  =  U1_GAA(x4)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ PiDPToQDPProof
QDP
                  ↳ UsableRulesReductionPairsProof

Q DP problem:
The TRS P consists of the following rules:

F_IN_GAA(s(X)) → F_IN_GAA(X)
U1_GAA(f_out_gaa(U)) → F_IN_GAA(U)
F_IN_GAA(s(X)) → U1_GAA(f_in_gaa(X))

The TRS R consists of the following rules:

f_in_gaa(0) → f_out_gaa(0)
f_in_gaa(s(X)) → U1_gaa(f_in_gaa(X))
U1_gaa(f_out_gaa(U)) → U2_gaa(f_in_gaa(U))
U2_gaa(f_out_gaa(Z)) → f_out_gaa(Z)

The set Q consists of the following terms:

f_in_gaa(x0)
U1_gaa(x0)
U2_gaa(x0)

We have to consider all (P,Q,R)-chains.
By using the usable rules with reduction pair processor [15] with a polynomial ordering [25], all dependency pairs and the corresponding usable rules [17] can be oriented non-strictly. All non-usable rules are removed, and those dependency pairs and usable rules that have been oriented strictly or contain non-usable symbols in their left-hand side are removed as well.

The following dependency pairs can be deleted:

F_IN_GAA(s(X)) → F_IN_GAA(X)
U1_GAA(f_out_gaa(U)) → F_IN_GAA(U)
F_IN_GAA(s(X)) → U1_GAA(f_in_gaa(X))
The following rules are removed from R:

f_in_gaa(s(X)) → U1_gaa(f_in_gaa(X))
U1_gaa(f_out_gaa(U)) → U2_gaa(f_in_gaa(U))
Used ordering: POLO with Polynomial interpretation [25]:

POL(0) = 0   
POL(F_IN_GAA(x1)) = 2·x1   
POL(U1_GAA(x1)) = 1 + x1   
POL(U1_gaa(x1)) = 2·x1   
POL(U2_gaa(x1)) = x1   
POL(f_in_gaa(x1)) = 2 + x1   
POL(f_out_gaa(x1)) = 2 + 2·x1   
POL(s(x1)) = 2 + 2·x1   



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ PiDPToQDPProof
                ↳ QDP
                  ↳ UsableRulesReductionPairsProof
QDP
                      ↳ PisEmptyProof

Q DP problem:
P is empty.
The TRS R consists of the following rules:

f_in_gaa(0) → f_out_gaa(0)
U2_gaa(f_out_gaa(Z)) → f_out_gaa(Z)

The set Q consists of the following terms:

f_in_gaa(x0)
U1_gaa(x0)
U2_gaa(x0)

We have to consider all (P,Q,R)-chains.
The TRS P is empty. Hence, there is no (P,Q,R) chain.